#version 120

attribute vec3 VertexPosition;
attribute vec3 VertexNormal;

varying vec3 Position;
varying vec3 Normal;

uniform mat4 MatrixModel;
uniform mat4 MatrixView;
uniform mat4 MatrixProjection;

void main()
{
  mat4 MatrixMV  =  MatrixView * MatrixModel;
  mat4 MatrixMVP = MatrixProjection * MatrixMV;
  mat3 MatrixNormal = mat3(MatrixMV);
  
  Position = vec3(MatrixMV * vec4(VertexPosition, 1.0));
  Normal = normalize(MatrixNormal * VertexNormal);
  
  gl_Position = MatrixMVP * vec4(VertexPosition, 4.0);
}